import axios from './axios'
import qs from 'qs'
export function getContractList() {
    return axios.get('/import_and_export/manage/consignment_order_list.do').then(res=>Promise.resolve(res.data))
}
export function addContract({contractNumber,contractDateStr,customer,transportMethod,marks,consignmentOrderDetails,totalPrice}) {
    const data = qs.stringify({contractNumber,contractDateStr,customer,transportMethod,marks,consignmentOrderDetails,totalPrice});
    return axios.post('/import_and_export/manage/save_consignment_order.do',data).then(res=>Promise.resolve(res.data));
}


export function modContract({id,contractNumber,contractDateStr,customer,transportMethod,marks,consignmentOrderDetails,totalPrice}) {
    const data = qs.stringify({id,contractNumber,contractDateStr,customer,transportMethod,marks,consignmentOrderDetails,totalPrice});
    return axios.post('/import_and_export/manage/update_consignment_order.do',data).then(res=>Promise.resolve(res.data));
}
export function contractFile(formData) {
    return axios.post('/import_and_export/manage/excel_consignment_order',formData,{
        headers:{'Content-Type':'multipart/form-data'}
    }).then(res=>Promise.resolve(res.data));
}

export function getContractDetail(consignmentOrderId) {
    return axios.post('/import_and_export/manage/show_consignment_order.do',qs.stringify({consignmentOrderId})).then(res=>Promise.resolve(res.data));
}



//进出口
export function getExportList() {
    return axios.get('/spare_export/manage/get_spare_export_list.do').then(res=>Promise.resolve(res.data));
}

export function addExport(exp) {
    return axios.post('/spare_export/manage/add_spare_export.do',qs.stringify(exp)).then(res=>Promise.resolve(res.data));
}

//进口
export function addImport(imp) {
    return axios.post('/spare_import/manage/add_spare_import.do',qs.stringify(imp)).then(res=>Promise.resolve(res.data));
}
export function getImportList() {
    return axios.get('/spare_import/manage/get_spare_import_list.do').then(res=>Promise.resolve(res.data));
}

export function getInventory({pageSize,pageNum,warehouse,partsNum}) {
    return axios.post('/warehouse/manage//select_spare_part_by_warehouse.do',qs.stringify({pageSize,pageNum,warehouse,partsNum})).then(res=>Promise.resolve(res.data))
}